﻿<Page
    x:Name="pageRoot"
    x:Class="Microsoft.PlayerFramework.Samples.TrackingPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Microsoft.PlayerFramework.Samples"
    xmlns:common="using:Microsoft.PlayerFramework.Samples.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:mmppf="using:Microsoft.PlayerFramework"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="3*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <mmppf:MediaPlayer x:Name="player" Source="http://smf.blob.core.windows.net/samples/videos/wildlife.mp4">
            <!--Also possible to do from xaml-->
            <!--<mmppf:MediaPlayer.Plugins>
                <mmppf:PositionTrackingPlugin>
                    <mmppf:PositionTrackingPlugin.TrackingEvents>
                        <mmppf:PositionTrackingEvent PositionPercentage="0" Data="start"/>
                        <mmppf:PositionTrackingEvent Position="00:00:05" Data="5 seconds"/>
                        <mmppf:PositionTrackingEvent PositionPercentage="1" Data="end"/>
                    </mmppf:PositionTrackingPlugin.TrackingEvents>
                </mmppf:PositionTrackingPlugin>
                <mmppf:PlayTimeTrackingPlugin>
                    <mmppf:PlayTimeTrackingPlugin.TrackingEvents>
                        <mmppf:PlayTimeTrackingEvent PlayTimePercentage="0" Data="Play time: started"/>
                        <mmppf:PlayTimeTrackingEvent PlayTime="00:00:05" Data="Play time: 5 seconds"/>
                        <mmppf:PlayTimeTrackingEvent PlayTimePercentage="1" Data="Play time: ended"/>
                        <mmppf:PlayTimeTrackingEvent PlayTimePercentage="1.25" Data="Play time: past end"/>
                    </mmppf:PlayTimeTrackingPlugin.TrackingEvents>
                </mmppf:PlayTimeTrackingPlugin>
            </mmppf:MediaPlayer.Plugins>-->
        </mmppf:MediaPlayer>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <StackPanel>
                <TextBlock FontWeight="Bold"  Text="PlayTime tracking events:"/>
                <ItemsControl x:Name="PlayTimeEventList" DisplayMemberPath="Data"/>
            </StackPanel>
            <StackPanel Grid.Column="1">
                <TextBlock FontWeight="Bold" Text="Position tracking events:"/>
                <ItemsControl x:Name="PositionEventList" DisplayMemberPath="Data"/>
            </StackPanel>
            <StackPanel Grid.Column="2">
                <TextBlock FontWeight="Bold"  Text="Events fired:"/>
                <ItemsControl x:Name="ResultsEventList">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Timestamp}"/>
                                <TextBlock Margin="20,0,0,0" Text="{Binding TrackingEvent.Data}"/>
                            </StackPanel>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </StackPanel>
        </Grid>
    </Grid>
</Page>
